The present invention relates to video compression, and more particularly to a method and apparatus for detecting scene changes and adjusting the picture coding type to optimize the coding efficiency of a video encoder. The invention is particularly useful for picture coding type decision and scene change detection in a digital HDTV encoder.
Aligning intra-coded (I) frames with scene changes can significantly improve the coding efficiency of an MPEG (Moving Picture Expert""s Group) video encoder. In the past, such scene change detection has been provided, for example, by detecting variations in luminance values.
In some existing scene change detection proposals, the coding of an I-frame is avoided until the scene change is over and a new GOP (group of pictures) is started. However, scene change detection is performed on a frame-by-frame basis. Therefore, this approach can yield incorrect results where there are bad edits, special effects or camera flashes, where the scene change might occur on the odd/even field boundary of the same frame.
Accordingly, it would be advantageous to provide a system for detecting scene changes, including flashes, or bad fields that result from improper editing, and adjusting the picture coding type without the aforementioned problems encountered by the prior art. It would be further advantageous to better optimize the coding efficiency of a video encoder during scene changes. It would also be desirable to provide an efficient system for scheduling a new GOP based on the detection of a scene change. Moreover, the system should detect scene changes between successive fields.
The system should make use of an encoding processing pipeline architecture that provides the required lookahead delay to avoid issuing a scheduled I-frame at the proximity of a scene change, while minimizing the amount of frame buffer memory required to provide the lookahead capability.
The scheme should be compatible with different HDTV modes/pixel resolutions, including 1920xc3x971080 I (interlaced scan), 1440xc3x971080 I, and 1280xc3x97720 p (progressive scan), as well as standard definition (SDTV) video.
The system should be compatible with any digital video coding scheme, including MPEG-2.
The system should inhibit the encoding of I-frames when an encoder buffer level is too high.
The system should provide a watchdog counter that resets the scene change indication to avoid a perpetual scene change state for transitions from still to motion.
For an MPEG film mode frame picture that is determined to be a scene change frame, to improve coding accuracy and efficiency, the system should deactivate the MPEG-recommended frame-based Discrete Cosine Transform (DCT) and prediction encoding when a scene change may have occurred on a field boundary.
The present invention provides a scene change and adjustment scheme having the aforementioned and other advantages.
The present invention relates to an efficient video compression scheme that detects scene changes between successive fields, including flashes, or bad fields that result from improper editing, and adjusts the picture coding type and GOP boundaries in response thereto. The term xe2x80x9cscene changexe2x80x9d is thus used generally herein to encompass events including a normal scene change (at a frame boundary), a scene change at a field boundary of the same frame, a bad edit or flash, or any other sudden change in a sequence of video images.
In accordance with the present invention, scene change detection is performed at a preprocessing stage of a video encoder. The final decision to encode a frame as an I- or P-frame is not made until a final encoding stage. That is, the encoder""s processing pipeline is used as a lookahead buffer to minimize the amount of required frame buffer memory.
In particular, the preprocessing stage of the video encoder calculates a change in the sum of pixel differences between consecutive odd fields, or consecutive even fields, for every consecutive input field. A scene change is then detected by looking for a large positive value (exceeding a positive threshold) in the change in sum, followed by a large negative value (less than a negative threshold) I-frames are inhibited at the encoding stage of the processing pipeline as soon as a scene change is detected. A new GOP is started when a scene change frame arrives at the encoding stage of the pipeline, and there is no other scene change frame in the pipeline.
A scene change counter is used to keep track of the number of uncoded scene change frames currently in the processing pipeline. I-frames are prohibited for as long as the scene change counter has a value greater than zero, except for the last scene change frame in a burst (succession) of scene change frames.
Additionally, a, scene change countdown counter, or xe2x80x9cwatchdogxe2x80x9d counter, is used to account for a transition from a still frame to a motion frame to ensure that a scene change is not set permanently.
Moreover, for an MPEG film mode picture that is determined to be a scene change frame, the MPEG-recommended frame-based Discrete Cosine Transform (DCT) and prediction encoding is deactivated when a scene change is indicated at a field boundary (e.g., when there is no redundant field in the picture). Upon such deactivation, either frame- or field-based DCT and prediction can be use on a macroblock-by-macroblock basis in the picture. This allows field prediction to be used to handle bad edits where a scene change may occur at the odd/even field boundary of the same frame.
The invention is suitable for use with both high definition television (HDTV) encoders and standard definition television (SDTV) encoders.